package cn.source.system.config;

import cn.hutool.extra.mail.MailAccount;
import cn.source.system.domain.DbConn;
import cn.source.system.service.IDbConnService;
import cn.source.system.utils.SpringFactoryUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.List;

@Configuration
@Slf4j
public class DataSourceConfig {

    @Autowired
    private IDbConnService dbConnService;

    @PostConstruct
    public void init() {
        log.info("初始化数据源");
        List<DbConn> dbConns = dbConnService.selectDbConnList(new DbConn());
        for (DbConn dbConn : dbConns) {
            dbConnService.testconn(dbConn);
        }
    }



}
